<template>
  <root id="app">
    <safe-header
      v-bind="{
        title: '个人中心',
        fixedTop: true,
        color: '#fff',
        textColor: '#000',
      }"
    />
    <!--    个人信息    -->
    <v-container style="margin-top: 12px">
      <v-card style="width: 100%; margin: 0 auto">
        <v-card-title
          :title="personInfo['empName'] + ' ' + personInfo.userName + ''"
        >
          <v-avatar class="main-bg">
            <v-icon size="32" dark>{{ mdiAccount }}</v-icon>
          </v-avatar>
        </v-card-title>
        <v-card-text class="pa-0 pl-4">
          <v-row class="flex-wrapper ma-0">
            <p>{{ $t("base.email") }}</p>
            <p>{{ personInfo.userEmail }}</p>
          </v-row>
        </v-card-text>
        <v-card-text class="pa-0 pl-4">
          <v-row class="flex-wrapper ma-0">
            <p v-text="this.showWorkCenterOrFactory"></p>
            <p>{{ factoryName }}</p>
          </v-row>
        </v-card-text>
      </v-card>
    </v-container>
    <!--   功能页面   -->
    <v-container :z-depth="0" class="demo-list-wrap">
      <v-list class="item-border-b">
        <!-- <v-list-item button :ripple="false">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20">speaker_notes </v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{
              $t("base.voice_announcements")
            }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action class="ma-0">
            <v-list-item-action class="ma-0">
              <v-switch
                color="#193690"
                v-model="voice"
                :label="voiceLabel"
                ripple
                @change="changeData('voice', $event)"
              ></v-switch>
            </v-list-item-action>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider>
        <v-list-item button :ripple="false">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20">record_voice_over </v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{ $t("base.audible_tone") }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action class="ma-0">
            <v-list-item-action class="ma-0">
              <v-switch
                color="#193690"
                v-model="voiceTip"
                :label="voiceTipLabel"
                ripple
                @change="changeData('voiceTip', $event)"
              ></v-switch>
            </v-list-item-action>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider> -->

        <!-- <v-list-item button :ripple="false">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20" dark>{{ mdiAccountCog }}</v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{
              $t("base.automatic_logon")
            }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action class="ma-0">
            <v-list-item-action class="ma-0">
              <v-switch
                color="#193690"
                v-model="autoLogin"
                :label="loginLabel"
                ripple
                @change="changeData('autoLogin', $event)"
              ></v-switch>
            </v-list-item-action>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider> -->

        <!-- <v-list-item button @click="bindWorkCellClk">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20">donut_small </v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{
              $t("base.binding_station")
            }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action>
            <v-icon value="keyboard_arrow_right"></v-icon>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider> -->
        <!-- <v-list-item button @click="changeNetwork">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20" dark>{{ mdiRss }}</v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{
              $t("base.switching_gateway")
            }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action>
            <v-icon value="keyboard_arrow_right"></v-icon>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider> -->

        <!-- <v-list-item button @click="changeFatory">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20" dark>{{ mdiHomeSwitch }}</v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{
              $t("base.switching_factories")
            }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action>
            <v-icon value="keyboard_arrow_right"></v-icon>
          </v-list-item-action>
        </v-list-item> -->
        <!-- <v-divider class="my-0 mx-1"></v-divider> -->

        <v-list-item button @click="passwordChange">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20" dark>{{ mdiKey }}</v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{
              $t("base.change_password")
            }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action>
            <v-icon value="keyboard_arrow_right"></v-icon>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider>
        <!-- 检查更新 -->
        <!-- <v-list-item button @click="checkUpdate">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20"> cloud_upload </v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{
              $t("base.check_updates")
            }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action>
            <v-icon value="keyboard_arrow_right"></v-icon>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider> -->
        <!-- 编辑菜单 -->
        <!-- <v-list-item button @click="editMenu">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20"> create </v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{ $t("base.edit_menu") }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action>
            <v-icon value="keyboard_arrow_right"></v-icon>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider> -->
        <!-- 远程控制 -->
        <!-- <v-list-item button @click="control">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20">desktop_mac </v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{
              $t("base.remote_control")
            }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action>
            <v-icon value="keyboard_arrow_right"></v-icon>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider> -->

        <v-list-item button @click="aboutFn">
          <v-list-item-action class="mr-4">
            <v-avatar size="28" class="main-bg">
              <v-icon size="20" dark>{{ mdiInformationVariant }}</v-icon>
            </v-avatar>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>{{ $t("base.about") }}</v-list-item-title>
          </v-list-item-content>
          <v-list-item-action>
            <v-icon value="keyboard_arrow_right"></v-icon>
          </v-list-item-action>
        </v-list-item>
        <v-divider class="my-0 mx-1"></v-divider>

        <!-- 退出登录弹框 -->
        <v-container class="button-wrapper">
          <v-row class="justify-center align-center ma-0">
            <v-btn
              block
              rounded
              large
              dark
              color="#193690"
              class="main-bg"
              @click="loginOut"
              >{{ $t("base.quit") }}</v-btn
            >
          </v-row>
        </v-container>
      </v-list>
    </v-container>

    <!-- 关于的弹框 -->
    <v-dialog
      :title="$t('base.about')"
      width="500"
      :scrollable="scrollable"
      v-model="openScroll"
      max-width="500"
      :padding="padding"
    >
      <v-list>
        <v-list-item
          >{{ $t("base.current_version") }}:{{ appVersion }}</v-list-item
        >
        <v-list-item
          >{{ showWorkCenterOrFactory }}:{{ factoryName }}</v-list-item
        >
      </v-list>
      <v-btn slot="actions" text color="primary" @click="closeScrollDialog">{{
        $t("base.confirm")
      }}</v-btn>
    </v-dialog>

    <!-- 修改密码的弹框 -->
    <v-dialog
      :title="$t('base.change_password')"
      width="500"
      :scrollable="scrollableP"
      v-model="openScrollP"
      max-width="330"
      :padding="padding"
    >
      <v-card>
        <v-card-title>修改密码</v-card-title>
        <v-card-text>
          <v-text-field
            v-if="0"
            ref="username"
            v-model="user.username"
            :label="$t('base.username')"
            help-text
            :prepend-icon="mdiAccountCircle"
            :error-text="usernameText"
          ></v-text-field>
          <v-text-field
            ref="oldPassword"
            v-model="user.oldPassword"
            :label="$t('base.password')"
            :prepend-icon="mdiLock"
            :error-text="oldPasswordText"
            type="password"
          ></v-text-field>
          <v-text-field
            ref="newPassword"
            v-model="user.newPassword"
            :label="$t('base.new_password')"
            :prepend-icon="mdiLock"
            :error-text="newPasswordText"
            type="password"
          ></v-text-field>
        </v-card-text>

        <v-card-actions class="justify-end">
          <v-btn
            text
            color="primary"
            :esc-press-close="false"
            :overlay-close="false"
            @click="cancelUpdatePassWord"
            >{{ $t("base.cancel") }}</v-btn
          >
          <v-btn text color="primary" @click="updatePassWord">{{
            $t("base.confirm_change")
          }}</v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>

    <!-- 下载进度条 -->
    <v-dialog width="360" transition="slide-bottom" v-model="openFullscreen">
      <v-card>
        <v-card-title style="background: #193690; color: #fff" class="pa-3">
          {{ $t("message.message_login_update_down") }}
        </v-card-title>
        <v-card-text class="py-5">
          <v-row class="linear-progress ma-0">
            <v-col cols="12">
              <div class="download-modal">
                <v-progress-linear
                  :value="linear"
                  size="18"
                  mode="determinate"
                  color="green"
                ></v-progress-linear>
                <div style="mt-4">
                  {{ $t("message.message_login_update_downing") }}
                </div>
                <div class="percent">{{ linear }}%</div>
              </div>
            </v-col>
          </v-row>
        </v-card-text>
        <v-card-actions class="justify-end">
          <v-btn
            text
            color="#193690"
            @click="
              () => {
                openFullscreen = false;
              }
            "
            >返回</v-btn
          >
        </v-card-actions>
      </v-card>
    </v-dialog>
  </root>
</template>
<script>
import http from "../../utils/http.js";
import qs from "qs";
import business from "../../utils/business_product.js";
import Root from "@/components/Root.vue";
import Storage from "../../utils/storage.js";
import {
  mdiAccountCircle,
  mdiLock,
  mdiEye,
  mdiEyeOff,
  mdiCog,
  mdiAccount,
  mdiAccountCog,
  mdiRss,
  mdiHomeSwitch,
  mdiKey,
  mdiInformationVariant,
} from "@mdi/js";
import SafeHeader from "../../components/safeHeader_wms";

// Vue.use(this.$message);

export default {
  name: "Mine",
  components: { Root, SafeHeader },
  data: () => {
    return {
      // icon
      mdiAccountCircle: mdiAccountCircle,
      mdiLock: mdiLock,
      mdiEye: mdiEye,
      mdiEyeOff: mdiEyeOff,
      mdiCog: mdiCog,
      mdiAccount: mdiAccount,
      mdiAccountCog: mdiAccountCog,
      mdiRss: mdiRss,
      mdiHomeSwitch: mdiHomeSwitch,
      mdiKey: mdiKey,
      mdiInformationVariant: mdiInformationVariant,
      //
      voice: false,
      voiceTip: false,
      autoLogin: false,
      openScroll: false,
      scrollable: true,
      openScrollP: false,
      scrollableP: true,
      voiceLabel: "关",
      voiceTipLabel: "关",
      loginLabel: "关",
      appVersion: "",
      bindWorkCell: "",
      currentWorkCenterOrFactory: "",
      workCenterName: "",
      factoryName: "",
      padding: 15,
      user: {
        username: "",
        oldPassword: "",
        newPassword: "",
      },
      visibility: false,
      usernameText: "",
      oldPasswordText: "",
      newPasswordText: "",
      loginLoading: false,
      openFullscreen: false,
      linear: 0,
      personInfo: {
        empName: "",
        userName: "",
        userEmail: "",
      },
      showWorkCenterOrFactory: "",
    };
  },
  methods: {
    changeData(value, e) {
      if (value == "voice") {
        Storage.setItem("_isVoice", e);
        this.voice
          ? (this.voiceLabel = this.$i18n.t("base.on"))
          : (this.voiceLabel = this.$i18n.t("base.off"));
      } else if (value == "voiceTip") {
        Storage.setItem("_isVoiceTip", e);
        this.voiceTip
          ? (this.voiceTipLabel = this.$i18n.t("base.on"))
          : (this.voiceTipLabel = this.$i18n.t("base.off"));
      } else if (value == "autoLogin") {
        Storage.setItem("_isAutoLogin", e);
        this.autoLogin
          ? (this.loginLabel = this.$i18n.t("base.on"))
          : (this.loginLabel = this.$i18n.t("base.off"));
      }
    },
    goPage(sysGranularity) {
      let name = "";
      let url = "";
      // 0是组工厂模式；1是组工作中心模式
      if (sysGranularity == "0") {
        name = "Factory";
        url = "./Factory.html";
      } else {
        name = "WorkCenter";
        url = "./WorkCenter.html";
      }
      if (window.navigator.userAgent.toLowerCase().includes("apicloud")) {
        window.api.openWin({
          name: name,
          url: url,
        });
      } else {
        this.$root.api.api.openWin({
          name: name,
          url: url,
        });
      }
    },
    changeFatory() {
      let loginConfig = Storage.getObject("loginConfig");
      let sysGranularity = loginConfig.sysGranularity;
      this.goPage(sysGranularity);
    },
    bindWorkCellClk() {
      if (window.navigator.userAgent.toLowerCase().includes("apicloud")) {
        window.api.openWin({
          name: "WorkCell",
          url: "./WorkCell.html",
          pageParam: {
            name: "",
          },
        });
      } else {
        this.$root.api.api.openWin({
          name: "WorkCell",
          url: "./WorkCell.html",
          pageParam: {
            name: "",
          },
        });
      }
    },
    passwordChange() {
      this.openScrollP = true;
    },
    cancelUpdatePassWord() {
      this.openScrollP = false;
    },
    async updatePassWord() {
      if (!this.user.username) {
        this.usernameText = this.$i18n.t("base.username_change");
        this.$refs.username.focus();
        return false;
      } else {
        this.usernameText = "";
      }
      if (!this.user.oldPassword) {
        this.oldPasswordText = this.$i18n.t("base.password_change");
        this.$refs.oldPassword.focus();
        return false;
      } else {
        this.oldPasswordText = "";
      }
      if (!this.user.newPassword) {
        this.newPasswordText = this.$i18n.t("base.new_password_change");
        this.$refs.newPassword.focus();
        return false;
      } else {
        this.newPasswordText = "";
      }
      let params = {};
      params.username = this.user.username;
      params.oldPassword = this.user.oldPassword;
      params.newPassword = this.user.newPassword;
      try {
        let res = await business.doChangePwd(params);
        if (res.status == 200 && res.data.erroCode == 0) {
          this.$toast.success({ message: res.data.msg, close: false });
          this.openScrollP = false;
          Storage.removeItem("user");
          setTimeout(function () {
            // eslint-disable-next-line no-undef
            api.rebootApp();
          }, 3000);
        } else {
          this.$toast.error({ message: res.data.msg, close: false });
        }
      } catch (error) {
        this.$toast.error({ message: JSON.stringify(error), close: false });
      }
    },
    checkUpdate() {
      this.openFullscreen = true;
      const myVersion = window.api.appVersion;
      let that = this;
      if (window.navigator.userAgent.toLowerCase().includes("apicloud")) {
        http
          .post({
            url: "productPadCommController!getAppVer.m",
            data: { ver: window.api.appVersion },
          })
          .then((res) => {
            if (res.status == 200 && res.data.type == "success") {
              let fs = window.api.require("fs");
              fs.exist({ path: "fs://EpichustApp.apk" }, function (ret) {
                if (ret.exist) {
                  fs.remove(
                    { path: "fs://EpichustApp.apk" }
                    // function(ret, err
                    // ) {}
                  );
                }
              });
              let reslut = res.data.data.split(":");
              if (reslut[0] == "S") {
                let serverVersion = Number(reslut[1].replace(/\./g, ""));
                let thisVersion = Number(myVersion.replace(/\./g, ""));
                if (serverVersion > thisVersion) {
                  this.$message
                    .confirm(
                      this.$i18n.t("message.message_login_updateapp") +
                        reslut[1],
                      this.$i18n.t("base.prompt"),
                      {
                        type: "warning",
                      }
                    )
                    .then((res) => {
                      if (!res.result) {
                        return false;
                      }
                      this.openFullscreen = true;
                      let network = Storage.getObject("network");
                      let selectedIndex = Storage.getObject("selectedIndex");
                      network = network[selectedIndex];
                      let downloadUrl = `http://${network.ip}:${network.port}/${network.appName}/ext/download/EpichustApp_${reslut[1]}.apk`;
                      console.log(downloadUrl);
                      window.api.download(
                        {
                          url: downloadUrl,
                          report: true,
                          cache: true,
                          allowResume: true,
                          savePath: "fs://EpichustApp.apk",
                        },
                        function (ret) {
                          console.log(JSON.stringify(ret));
                          if (ret && ret.state == 0) {
                            /* 下载进行中 */
                            that.linear = ret.percent;
                          }
                          if (ret && ret.state == 1) {
                            /* 下载完成 */
                            that.linear = ret.percent;
                            let savePath = ret.savePath;
                            window.api.installApp({
                              appUri: savePath,
                            });
                          }
                          if (ret && ret.state == 2) {
                            this.$toast.error({
                              message: this.$i18n.t(
                                "message.message_login_update_error"
                              ),
                              close: false,
                            });
                          }
                        }
                      );
                    });
                } else if (serverVersion < thisVersion) {
                  this.$message.confirm(
                    this.$i18n.t("message.message_login_appversion"),
                    this.$i18n.t("base.prompt"),
                    { type: "warning" }
                  );
                } else if (serverVersion == thisVersion) {
                  this.$toast.success({
                    message: this.$i18n.t(
                      "message.message_mine_lastappversion"
                    ),
                    close: false,
                  });
                  //this.$message.confirm( "您当前版本已是最新版本,无需更新!。","提示",{ type: "warning"});
                }
              } else {
                this.$toast.error({ message: reslut, close: false });
              }
            }
          });
      }
    },
    control() {
      window.api.openApp(
        {
          //androidPkg: 'com.teamviewer.teamviewer.market.mobile',
          androidPkg: "com.teamviewer.teamviewer.market.mobile",
          mimeType: "text/html",
        },
        function (ret, err) {
          if (ret) {
            console.log(JSON.stringify(ret));
          } else {
            console.log(JSON.stringify(err));
          }
        }
      );
    },
    loginOut() {
      console.log(JSON.stringify(window.navigator.userAgent));
      if (window.navigator.userAgent.toLowerCase().includes("apicloud")) {
        window.api.closeToWin({
          name: "login_wms",
        });
      } else {
        window.api.closeToWin({
          name: "login_wms",
        });
      }
      // this.$message
      //   .confirm(
      //     this.$i18n.t("message.message_mine_quitout"),
      //     this.$i18n.t("base.prompt"),
      //     {
      //       type: "warning",
      //       icon: "cloud_upload",
      //       okLabel: this.$i18n.t("base.confirm"),
      //       cancelLabel: this.$i18n.t("base.cancel"),
      //     }
      //   )
      //   .then(({ result }) => {
      //     console.log(result);
      //     if (result) {
      //       if (window.navigator.userAgent.toLowerCase().includes("apicloud")) {
      //         window.api.closeToWin({
      //           name: "login",
      //         });
      //       } else {
      //         this.$root.api.api.closeToWin({
      //           name: "login",
      //         });
      //       }
      //     }
      //   });
    },
    aboutFn() {
      window.api.openFrame({
        name: "photoInterface",
        url: "./photoInterface.html",
        // rect: {
        //   x: 0,
        //   y: 0,
        //   w: "auto",
        //   h: "auto",
        // },
        fixedOn: "ui_layout",
        bgColor: "transparent",
      });
      // this.openScroll = true;
    },
    closeScrollDialog() {
      this.openScroll = false;
    },
    editMenu() {
      window.api.openWin({
        name: "EditMenu",
        url: "./EditMenu.html",
      });
    },
    // async getUserInfo() {
    //   try {
    //     let loginConfig = Storage.getObject("loginConfig");
    //     let loginName = loginConfig.un;
    //     let data = qs.stringify({ loginName: loginName });
    //     await http
    //       .post({
    //         url: "productPadCommController!getUserInfoByLoginName.m",
    //         data,
    //         autoLogin: true,
    //       })
    //       .then((res) => {
    //         if (res.status == 200 && res.data.type == "error") {
    //           this.$toast.error({
    //             message: JSON.stringify(res.data.data),
    //             close: false,
    //           });
    //         } else {
    //           let arr = res.data.data;
    //           this.personInfo = JSON.parse(arr);
    //           if (this.personInfo.hasEmp == "n") {
    //             this.personInfo.empName = "";
    //           }
    //         }
    //       });
    //   } catch (error) {
    //     this.$toast.error({
    //       message: JSON.stringify(error),
    //       close: false,
    //     });
    //   }
    // },
    changeNetwork() {
      if (window.navigator.userAgent.toLowerCase().includes("apicloud")) {
        window.api.openWin({
          name: "network",
          url: "./network.html",
          pageParam: {
            name: "",
          },
        });
      } else {
        this.$root.api.api.openWin({
          name: "network",
          url: "./network.html",
          pageParam: {
            name: "",
          },
        });
      }
      window.api.openWin({
        name: "network",
        url: "./network.html",
        pageParam: {
          name: "",
        },
      });
    },
  },
  mounted: function () {
    // this.$nextTick(function () {
    //   this.getUserInfo();
    // });
    //从localstorage中拿到在登陆页面选择的语言类型
    let lang = Storage.getObject("lang").value;
    if (lang) {
      this.$i18n.locale = lang;
    } else {
      this.$i18n.locale = "cn";
    }
    //从localstorage中拿到是否为工厂
    this.appVersion = window.api.appVersion;
    let loginConfig = Storage.getObject("loginConfig");
    this.user.username = loginConfig.un;
    let sysGranularity = loginConfig.sysGranularity; // 0是组工厂模式；1是组工作中心模式
    //let isMultipleWorkCenters = loginConfig.isMultipleWorkCenters; // 是否启用多工作中心  false 不启用, true 启用
    let multipleObj = Storage.getObject("multipleObj");
    sysGranularity == "0"
      ? (this.currentWorkCenterOrFactory = "工厂")
      : (this.currentWorkCenterOrFactory = "工作中心");
    sysGranularity == "0"
      ? (this.showWorkCenterOrFactory = this.$i18n.t("base.factory"))
      : (this.showWorkCenterOrFactory = this.$i18n.t("base.workcenter"));
    if (multipleObj == null) {
      sysGranularity == "0"
        ? (this.factoryName = "")
        : (this.workCenterName = "");
    } else {
      sysGranularity == "0"
        ? (this.factoryName =
            multipleObj.siteName + `(${multipleObj.siteCode})`)
        : (this.workCenterName =
            multipleObj.workCenterName + `(${multipleObj.workCenterCode})`);
    }
    let isVoice = Storage.getItem("_isVoice");
    let isVoiceTip = Storage.getItem("_isVoiceTip");
    let isAutoLogin = Storage.getItem("_isAutoLogin");
    // 语言播报
    if (isVoice == "true") {
      this.voiceLabel = this.$i18n.t("base.on");
      this.voice = true;
    } else {
      this.voiceLabel = this.$i18n.t("base.off");
      this.voice = false;
    }
    // 声音提示
    if (isVoiceTip == "true") {
      this.voiceTipLabel = this.$i18n.t("base.on");
      this.voiceTip = true;
    } else {
      this.voiceTipLabel = this.$i18n.t("base.off");
      this.voiceTip = false;
    }
    // 自动登录
    if (isAutoLogin == "true") {
      this.loginLabel = this.$i18n.t("base.on");
      this.autoLogin = true;
    } else {
      this.loginLabel = this.$i18n.t("base.off");
      this.voiautoLoginceTip = false;
    }
    // 解决手机上切换工厂无效的问题
  },
};
</script>
<style scoped lang="scss">
.demo-list-wrap {
  width: 100%;
  overflow: hidden;
}
.download-modal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  height: 100%;
  // min-height: 60vh;
  width: 100%;
  .linear-progress {
    width: 100%;
  }
  .percent {
    font-size: 12vw;
    line-height: 1.5;
    color: rgb(76, 175, 80);
  }
}
</style>
